package com.dc.kylin.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {

    //声明队列
    @Bean
    public Queue directQueue01(){
        return new Queue("directQueue01");
    }

    @Bean
    public Queue directQueue02(){
        return new Queue("directQueue02");
    }


    //声明交换机
    @Bean
    public DirectExchange setDirectExchange(){
        return new DirectExchange("directExchange");
    }


    //声明绑定关系
    @Bean
    public Binding bindingExchange01(){
        return BindingBuilder.bind(directQueue01()).to(setDirectExchange()).with("directExchange01");
    }

    @Bean
    public Binding bindingExchange02(){
        return BindingBuilder.bind(directQueue02()).to(setDirectExchange()).with("directExchange02");
    }



}
